export const DATE_LIST = [

  {
    dateText: '2022-05-05',
    week: 4,
    morningShift: ['08:00~12:00', '14:00~16:00'],
    eveningShift: ['17:00~23:00', '00:00~07:00'],
    id: 0
  },
  {
    dateText: '2022-05-04',
    week: 3,
    morningShift: ['08:00~12:00', '14:00~16:00'],
    eveningShift: ['17:00~24:00', '00:00~07:00'],
    id: 1
  },
  {
    dateText: '2022-05-07',
    week: 6,
    morningShift: ['08:00~12:00', '14:00~16:00'],
    eveningShift: ['17:00~23:00', '00:00~07:00'],
    id: 20
  }

]
export const WEEK_LIST = [
  {
    value: 1,
    label: '星期一'
  }, {
    value: 2,
    label: '星期二'
  }, {
    value: 3,
    label: '星期三'
  }, {
    value: 4,
    label: '星期四'
  }, {
    value: 5,
    label: '星期五'
  },
  {
    value: 6,
    label: '星期六'
  },
  {
    value: 0,
    label: '星期天'
  }
]
export function getWeek(begin, end, weekNum) {
  var dateArr = new Array()
  var stimeArr = begin.split('-')// =>["2018", "01", "01"]
  var etimeArr = end.split('-')// =>["2018", "01", "30"]

  var stoday = new Date()
  stoday.setUTCFullYear(stimeArr[0], stimeArr[1] - 1, stimeArr[2])
  var etoday = new Date()
  etoday.setUTCFullYear(etimeArr[0], etimeArr[1] - 1, etimeArr[2])

  var unixDb = stoday.getTime()// 开始时间的毫秒数
  var unixDe = etoday.getTime()// 结束时间的毫秒数

  for (var k = unixDb; k <= unixDe;) {
    const needJudgeDate = msToDate(parseInt(k)).withoutTime
    // 不加这个if判断直接push的话就是已知时间段内的全部日期
    if (new Date(needJudgeDate).getDay() === weekNum) {
      dateArr.push(needJudgeDate)
    }
    k = k + 24 * 60 * 60 * 1000
  }
  return dateArr
}

// 根据毫秒数获取日期
function msToDate(msec) {
  const datetime = new Date(msec)
  const year = datetime.getFullYear()
  const month = datetime.getMonth()
  const date = datetime.getDate()
  const hour = datetime.getHours()
  const minute = datetime.getMinutes()
  const second = datetime.getSeconds()

  const result1 = year +
        '-' +
        ((month + 1) >= 10 ? (month + 1) : '0' + (month + 1)) +
        '-' +
        ((date + 1) < 10 ? '0' + date : date) +
        ' ' +
        ((hour + 1) < 10 ? '0' + hour : hour) +
        ':' +
        ((minute + 1) < 10 ? '0' + minute : minute) +
        ':' +
        ((second + 1) < 10 ? '0' + second : second)

  const result2 = year +
        '-' +
        ((month + 1) >= 10 ? (month + 1) : '0' + (month + 1)) +
        '-' +
        ((date + 1) < 11 ? '0' + date : date)

  const result = {
    hasTime: result1,
    withoutTime: result2
  }

  return result
}
export const SPARE_LIST = [
  {
    name: '机匣'
  }, {
    name: '叶片'
  },
  {
    name: '其他'
  }
]
export const BATCH_LIST = [
  {
    name1: '日期+流水号',
    name2: '机匣',
    name3: false,
    name4: '20220423001',
    url: require('./recipe/img/tiaoxingma.png')
  },
  {
    name1: '零件代码+流水号编码',
    name2: '机匣',
    name3: true,
    name4: '410ue384702001',
    url: require('./recipe/img/tiaoxingma2.png')
  },
  {
    name1: '组合编码(批产/研制+日期+零件代码+流水号编码)',
    name2: '',
    name3: false,
    name4: 'PC2022-422410ue384702001',
    url: require('./recipe/img/tiaoxingma3.png')
  }
]
export const POST_LIST = [
  {
    name: '高级'
  }, {
    name: '中级'
  }
]
export const TAG_LIST = [
  {
    name: '化学热处理单元',
    state: 2,
    data: +(Math.random() * 2).toFixed(2),
    id: 0,
    data1: [820, 932, 901, 334, 1290, 1330, 1320]
  },
  {
    name: '常规热处理单元', data: +(Math.random() * 5).toFixed(2),
    id: 1,
    state: 2,
    data1: [820, 932, 901, 934, 190, 1330, 1320]
  }, {
    name: '真空热处理单元', data: +(Math.random() + 0.3).toFixed(2),
    state: 2,
    id: 2,
    data1: [820, 932, 101, 934, 1290, 1330, 1320]
  }
  // , {
  //   name: '蜡模三坐标', data: +Math.random().toFixed(2),
  //   state: 2,
  //   id: 3,
  //   data1: [820, 932, 901, 934, 2290, 1330, 1320]
  // }, {
  //   name: '蜡模组合', data: +(Math.random() * 2).toFixed(2),
  //   state: 2,
  //   id: 4
  // }, {
  //   name: '浇倒压制', data: +(Math.random() * 2).toFixed(2),
  //   state: 2,
  //   id: 5,
  //   data1: [120, 932, 901, 934, 1290, 1330, 1320]
  // }, {
  //   name: '型壳制造', data: +(Math.random() * 2).toFixed(2),
  //   state: 1,
  //   id: 6,
  //   data1: [820, 932, 901, 934, 1290, 1330, 1320]
  // }, {
  //   name: '型壳脱蜡', data: +(Math.random() * 2).toFixed(2),
  //   state: 0,
  //   id: 7,
  //   data1: [320, 332, 301, 334, 390, 330, 320]
  // }, {
  //   name: '型壳焙浇', data: +(Math.random() * 2).toFixed(2),
  //   state: 0,
  //   id: 8
  // }, {
  //   name: '型壳装箱', data: +(Math.random() * 2).toFixed(2),
  //   state: 0,
  //   id: 9,
  //   data1: [150, 232, 201, 154, 190, 330, 410]
  // },
  // {
  //   name: '型壳预热', data: +(Math.random() * 2).toFixed(2),
  //   state: 0,
  //   id: 10,
  //   data1: [120, 132, 101, 134, 90, 230, 210]
  // },
  // {
  //   name: '浇注', data: +(Math.random() * 2).toFixed(2),
  //   state: 0,
  //   id: 11,
  //   data1: [220, 182, 191, 234, 290, 330, 310]
  // }
]
